﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using EQT.Dal;
using EQT.Model;
using Common.Logging;

public partial class _Default : System.Web.UI.Page
{
    private static readonly ILog log = LogManager.GetCurrentClassLogger();
    private DaNotice dalNotice = DevFuture.Common.WorkContext.AppCtx.GetObject("DaNotice") as DaNotice;
    private UserContext context;

    protected void Page_Load(object sender, EventArgs e)
    {
        context = Session["USER_CONTEXT"] as UserContext;
        if (context == null)
        {
            Response.Redirect("~/login.aspx?r");
        }

        if (!IsPostBack)
        {
            this.QueryNotice();
        }
    }

    private void QueryNotice()
    {
        int pagecount = 0;        
        this.Repeater.DataSource = dalNotice.GetMyNoticeRecords(context.UserID, null, 10, 0, out pagecount);
        Repeater.DataBind();

        
    }


    public string Substring(string strContent)
    {
        return strContent.Length > 50? strContent.Substring(0, 50) +"...": strContent;
    }
}
